<template>
	<view  class="all">
		<view class="setBox">
			<view class="list" @click="changePwd">
				<view class="textname">
					修改密码
				</view>
				<view class="text">
					<text class="textonew"></text>
					<view class="texttwo">
					   <image src="https://www.yusivip.com/upload/commonAppimg/rightjiantou.png" mode=""></image>
					</view>
				</view>
			</view><view class="list" @click="logOutFn">
				<view class="textname">
					退出登录
				</view>
				<view class="text">
					<text class="textonew"></text>
					<view class="texttwo">
					   <image src="https://www.yusivip.com/upload/commonAppimg/rightjiantou.png" mode=""></image>
					</view>
				</view>
			</view>
			<view class="list">
				<view class="textname">
					版本：{{version}}
				</view>
				<view class="text">
					<text class="textonew"></text>
					<view class="texttwo">
					   <image src="https://www.yusivip.com/upload/commonAppimg/rightjiantou.png" mode=""></image>
					</view>
				</view>
			</view>
			<view class="list" @click="writeOff">
				<view class="textname">
					注销账号
				</view>
				<view class="text">
					<text class="textonew"></text>
					<view class="texttwo">
					   <image src="https://www.yusivip.com/upload/commonAppimg/rightjiantou.png" mode=""></image>
					</view>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import navigation from '@/component/navigation.vue'
	import sun from '@/utils/sun.js'
	import titleFix from "@/utils/titleFix";
	export default {
		name:"mySet",
		 mixins: [titleFix],
		components:{
			navigation			
		},
		data() {
			return {
				version:'',
				topheight:""
			}
		},
		onLoad(){
			let _this=this;
			this.topheight = sun.getStatusBarHeight();
			uni.getSystemInfo({
				success:(res) => {
					//开发工具
					// #ifdef APP-PLUS
						if(res.platform!="devtools"){
							plus.runtime.getProperty(plus.runtime.appid,function(inf){
								   _this.version=inf.version;  
							}); 	
						}
					// #endif
						}  
					})
		},
		methods: {
			// 修改密码
			changePwd(){
				uni.navigateTo({
					url:"../editPassword/editPassword"
				})
			},
			//退出登录
			logOutFn(){
				uni.showModal({
				    title: '提示',
				    content: '确定退出登录吗？',
				    success: function (res) {
				        if (res.confirm) {
				           uni.clearStorageSync();
				           				uni.navigateTo({
				           					url:"../../login/login"
				           				})
				           // #ifdef APP-PLUS  			   	   			
				           // #endif
				        } else if (res.cancel) {
				        }
				    }
				});
			},
			//注销账号
			writeOff(){
				//注销账号
				uni.showModal({
					title: '账号注销提醒',
					content: '账号注销无法恢复，请谨慎操作',					
					confirmText:"继续操作",
					cancelText:'再考虑下',
					confirmColor:'#ff4d4d',
					success: function (res) {
						if (res.confirm) {
							sun.request({
								url: "/h5/ucenter.passport/cancel",
								showLoading: true,
								token:true,
								data: {
									 									 
								},
								success(res) {									
									uni.clearStorageSync();
									uni.navigateTo({
										url:"../../login/login",
									})	
									uni.showToast({
										icon: "none",
										title: "注销成功",
									})
								},
								fail(e) {
									uni.showToast({
										icon: "none",
										title: "服务器开小差去啦~~",
									})
								}
							})
						} else if (res.cancel) {
						}
					}
			})
			},
		}
	}
</script>

<style lang="less">
page {
    background: #f4f4f4;
    padding-top: 0;
}
.setBox{
		    width: 100%;
			display: flex;
			justify-content: center;
			flex-wrap: wrap;
			padding-top:20px;
 .list{
 		margin-bottom: 32upx;
 		width: 702upx;
 		padding: 30upx 40upx;
 		box-sizing: border-box;
 		background-color: #ffffff;
 		box-shadow: 0upx 4upx 31upx 1upx 
 			rgba(24, 22, 31, 0.05);
 		border-radius: 10upx;
 		display: flex;
 		justify-content: space-between;
 		.textname{
 			font-family: PingFang-SC-Medium;
 				font-size: 30upx;
 				font-weight: normal;
 				font-stretch: normal;
 				letter-spacing: 0upx;
 				color: #000000;
 		}
 		.text{
 			display: flex;
           .textonew{
 			  font-family: PingFang-SC-Regular;
 			  	font-size: 26upx;
 			  	font-weight: normal;
 			  	font-stretch: normal;
 			  	letter-spacing: 0upx;
 			  	color: #f97432;
 		  }
 		  .texttwo{
 			  margin-left: 20upx;
 			  font-size: 30upx;
 			  image{
 				  width: 32upx;
 				  height: 32upx;
 			  }
 		  }
 		}
 	}	
}
</style>
